package com.newpage.module_gather.presenter;

import android.content.Context;

import com.newpage.module_gather.contract.GatherMainCon;
import com.newpage.module_gather.contract.QuestionManagerCon;
import com.wetao.lib_common.bean.response.SubjectInfo;
import com.wetao.lib_common.bean.response.WrongQuestionListInfo;
import com.wetao.lib_common.net.RetryWithDelay;
import com.wetao.lib_common.net.RxUtils;
import com.wetao.lib_common.net.ServerUtils;
import com.wetao.lib_common.net.callback.RequestCallback;
import com.wetao.lib_common.net.callback.RxErrorHandler;
import com.wetao.lib_common.utils.JsonUtils;

import java.util.HashMap;

import okhttp3.RequestBody;

/**
 * author: zhouyh
 * created on: 2021/6/17 10:37 上午
 * description:
 */
public class GatherMainPre extends GatherMainCon.Presenter {

    private Context mContext;

    public GatherMainPre(Context mContext) {
        this.mContext = mContext;
    }

//    @Override
//    public void querySubjectBySectionId(HashMap<String, String> map, boolean isDialog, boolean cancelable) {
//        String json =(JsonUtils.getmGson()).toJson(map);
//        RequestBody requestBody =  RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"),json);
//        ServerUtils.getCommonApi().querySubjectBySectionId(requestBody)
//                .retryWhen(new RetryWithDelay(2,1))
//                .compose(RxUtils.<SubjectInfo>bindToLifecycle(getView()))
//                .compose(RxUtils.<SubjectInfo>getSchedulerTransformer())
//                .subscribe(new RequestCallback<SubjectInfo>(mContext, RxErrorHandler.getInstance(),isDialog,cancelable) {
//                    @Override
//                    public void onNext(SubjectInfo baseResponse) {
//                        super.onNext(baseResponse);
//                        if(baseResponse.getCode() == 0){
//                            getView().querySubjectBySectionIdResult(baseResponse);
//                        }
//                    }
//                    @Override
//                    public void onError(Throwable e) {
//                        super.onError(e);
//                        getView().querySubjectBySectionIdFail();
//                    }
//                });
//    }
}
